package com.gis.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.sql.Timestamp;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;

/* 
 * CREATE TABLE node_table (
    id                  SERIAL PRIMARY KEY,             -- 自增主键

    script_id           INT,                            -- 脚本ID
    FOREIGN KEY (script_id) REFERENCES script_table(id), -- 外键关联script_table的id
    process_id          INT,                            -- 流程ID
    FOREIGN KEY (process_id) REFERENCES process_table(id), -- 外键关联process_table的id

    noode_description         TEXT,                           -- 节点描述

    serial_num          INT,                            -- 流程序号
    CHECK (serial_num >= 1),                             -- 流程序号必须大于1

    insert_time         TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_time        TIMESTAMP DEFAULT CURRENT_TIMESTAMP

);

COMMENT ON COLUMN node_table.id IS '自增ID';
COMMENT ON COLUMN node_table.script_id IS '脚本ID';
COMMENT ON COLUMN node_table.process_id IS '流程ID';
COMMENT ON COLUMN node_table.serial_num IS '节点序号';

COMMENT ON COLUMN node_table.noode_description IS '节点描述';
COMMENT ON COLUMN node_table.insert_time IS '插入时间';
COMMENT ON COLUMN node_table.updated_time IS '更新时间';

 */
@TableName("node_table")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NodeData implements Serializable{
    @JsonIgnore
    @TableId(type = IdType.AUTO)
    private Long id;                // 自增ID


    private String name;      // 节点名称
    private Long scriptId;        // 脚本ID
    private Long processId;      // 流程ID
    private String nodeDescription; // 节点描述
    private Integer serialNum;  // 节点序号

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField(exist = false, fill = FieldFill.DEFAULT)
    private ScriptData script;  // 脚本

    

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @TableField(exist = false, fill = FieldFill.DEFAULT)
    private ProcessData process; // 流程
    
    // private Timestamp insertTime;
    // private Timestamp updatedTime;

    
}
